from datetime import datetime, timedelta

def date_since(days, format='%Y%m%d'):
    # 获取当前时间
    now = datetime.now()
    days_ago = now - timedelta(days = days)
    # 为了更精确，可以使用dateutil.relativedelta考虑闰年
    # from dateutil.relativedelta import relativedelta
    # five_years_ago = now - relativedelta(years=5)

    # 格式化日期为 yyyymmdd
    formatted_date = days_ago.strftime(format)
    return days_ago
